﻿<%@ Page Title="Quản lý đề thi" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="frmAdTaoDeThi.aspx.cs" Inherits="Admin_frmAdTaoDeThi" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="wrap">
        <h2>
            Quản lý đề thi |
            <asp:HyperLink ID="HyperLink1" runat="server" CssClass="node"
            NavigateUrl="~/Admin/frmQuyTacDe.aspx" BackColor="#F1F1F2" >Qui tắc đề thi</asp:HyperLink>
        </h2>
    </div>
    <div style="clear: both;">&nbsp;<table style="width: 100%">
        <tr>
            <td style="width: 236px">
            <asp:Label ID="Label4" runat="server" Text="Ten De Thi"></asp:Label>
            </td>
            <td style="width: 190px">
            <asp:TextBox ID="txtTenDT" runat="server" Height="28px" TextMode="MultiLine" 
                Width="200px"></asp:TextBox>
            </td>
            <td rowspan="7" valign="top" style="width: 1039px">
                <asp:Panel ID="Panel1" runat="server" 
                    style="margin-right:20px;margin-left:20px;">
                    <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                        <ContentTemplate>
                            Thong Tin De Thi
                            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CssClass="GridViewStyle" 
                        DataSourceID="SqlDataSource2" GridLines="None" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged1" Width="709px">
                                <Columns>
                                    <asp:BoundField DataField="MaDT" HeaderText="Mã Đề Thi" />
                                    <asp:BoundField DataField="TenDeThi" HeaderText="Tên Đề Thi" >
                                    <ItemStyle Width="200px" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="MaQT" HeaderText="Mã Quy Tắc" />
                                    <asp:BoundField DataField="TenMonHoc" HeaderText="Tên Môn Học" />
                                    <asp:BoundField DataField="msLopTC" HeaderText="Mã Lớp TC" />
                                    <asp:BoundField DataField="NgayApDung" DataFormatString="{0:d/M/yyyy}" 
                                        HeaderText="Ngày Áp Dụng" />
                                </Columns>
                                <RowStyle CssClass="RowStyle" />
                                <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                                <PagerStyle CssClass="PagerStyle" />
                                <SelectedRowStyle CssClass="SelectedRowStyle" />
                                <HeaderStyle CssClass="HeaderStyle" />
                                <EditRowStyle CssClass="EditRowStyle" />
                                <AlternatingRowStyle CssClass="AltRowStyle" />
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td style="width: 236px">
            <asp:Label ID="Label3" runat="server" Text="Ten Mon"></asp:Label>
            </td>
            <td style="width: 190px">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="drlTenmon" runat="server" 
    Height="25px" Width="200px" DataSourceID="LinqDataSource6" DataTextField="TenMonHoc" 
                        DataValueField="MsMonHoc" AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:LinqDataSource ID="LinqDataSource6" runat="server" 
                        ContextTypeName="DataClassesDataContext" Select="new (MsMonHoc, TenMonHoc)" 
                        TableName="tbl_MONHOCs">
                    </asp:LinqDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
            
            </td>
        </tr>
        <tr>
            <td style="width: 236px">
                <asp:Label ID="Label5" runat="server" Text="Ma Lop Tin Chi"></asp:Label>
            </td>
            <td style="width: 190px">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="drlmaloptc" runat="server" DataSourceID="LinqDataSource2" 
                DataTextField="MsLopTC" DataValueField="MsLopTC" Height="25px" 
    Width="200px" AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                        ContextTypeName="DataClassesDataContext" Select="new (MsLopTC)" 
                        TableName="tbl_LOPTCs" Where="MsMonHoc == @MsMonHoc">
                        <WhereParameters>
                            <asp:ControlParameter ControlID="drlTenmon" Name="MsMonHoc" 
                                PropertyName="SelectedValue" Type="String" />
                        </WhereParameters>
                    </asp:LinqDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td style="width: 236px">
            <asp:Label ID="Label2" runat="server" Text="Ten Quy Tac"></asp:Label>
            </td>
            <td style="width: 190px">
            <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="drlQuytac" runat="server" 
    Height="25px" Width="200px" DataSourceID="LinqDataSource5" DataTextField="MaQT" 
                        DataValueField="MaQT" AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:LinqDataSource ID="LinqDataSource5" runat="server" 
                        ContextTypeName="DataClassesDataContext" Select="new (MaQT)" 
                        TableName="tbl_QUYTACDETHIs">
                    </asp:LinqDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td style="width: 236px">
                &nbsp;</td>
            <td style="width: 190px">
            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <ContentTemplate>
                    <asp:DetailsView ID="DetailsView2" runat="server" Height="16px" 
                Width="200px" AutoGenerateRows="False" 
    DataSourceID="LinqDataSource7">
                        <EditRowStyle CssClass="yEditRowStyle" />
                        <RowStyle CssClass="yRowStyle" />
                        <Fields>
                            <asp:BoundField DataField="MaQT" 
                        HeaderText="Mã Quy Tắc" >
                            <ControlStyle Width="10px" />
                            <ItemStyle Width="25px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="SoCH" 
                        HeaderText="Số Câu Hỏi" />
                            <asp:BoundField DataField="Kho" 
                        HeaderText="Số Câu Khó" />
                            <asp:BoundField DataField="TB" HeaderText="Số Câu TB" />
                            <asp:BoundField DataField="De" HeaderText="Số Câu Dễ" />
                            <asp:BoundField DataField="Thoigian" 
                        HeaderText="Thời gian" />
                        </Fields>
                        <HeaderStyle CssClass="yHeaderStyle" />
                        <PagerStyle CssClass="yPagerStyle" />
                        <AlternatingRowStyle CssClass="yAltRowStyle" />
                    </asp:DetailsView>
                    <asp:LinqDataSource ID="LinqDataSource7" runat="server" ContextTypeName="DataClassesDataContext" 
    Select="new (MaQT, SoCH, Kho, TB, De, Thoigian)" TableName="tbl_QUYTACDETHIs" 
    Where="MaQT == @MaQT">
                        <WhereParameters>
                            <asp:ControlParameter ControlID="drlQuytac" Name="MaQT" 
                                PropertyName="SelectedValue" Type="String" />
                        </WhereParameters>
                    </asp:LinqDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td style="width: 236px">
                Ngày thi</td>
            <td style="width: 190px">
                    
                    <asp:TextBox ID="txtDateTimePicker" runat="server" Width="196px"></asp:TextBox>
                </td>
        </tr>
        <tr>
            <td style="width: 236px">
            <asp:Button ID="btnThem" runat="server" onclick="btnThem_Click" CssClass="button"
                    Text="Them" Width="85px" Height="27px" />
            </td>
            <td style="width: 190px">
                    
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:TracNghiemTrucTuyenConnectionString %>" 
                        
                        
                    
                        SelectCommand="SELECT tbl_DETHI.MaDT, tbl_DETHI.MaQT, tbl_DETHI.TenDeThi, tbl_MONHOC.TenMonHoc, tbl_DETHI.MsLopTC, tbl_DETHI.NgayApDung FROM tbl_MONHOC INNER JOIN tbl_LOPTC ON tbl_MONHOC.MsMonHoc = tbl_LOPTC.MsMonHoc INNER JOIN tbl_DETHI ON tbl_LOPTC.MsLopTC = tbl_DETHI.MsLopTC">
                    </asp:SqlDataSource>
                </td>
        </tr>
        </table>
    </div>
    <script type="text/javascript" >
    
        $("#<%=txtDateTimePicker.ClientID%>").datepicker();
        function kiemtranhap() {
            if (($.trim($("#<%=txtDateTimePicker.ClientID%>").val()) == 0)
                || ($.trim($("#<%=txtTenDT.ClientID %>").val()) == 0)) {
                alert("Thông báo! Tên đề thi hoặc ngày thi chưa có giá trị!");
                return false;

            }
        }
    </script>
    </asp:Content>

